﻿using System;
using FluentNHibernate.Mapping;
using cludg.Domain.Content.Stories;
using cludg.Domain.Content.Stories.Subjects;

namespace cludg.Repository.NHibernate.Config.Content
{
	public class StorySubjectMap : ClassMap<StorySubject>
	{
		public StorySubjectMap()
		{
			Table("StorySubjects");
			Cache.ReadWrite();
			Not.LazyLoad();
			Id(x => x.Id).Length(50)
				.GeneratedBy.Custom<Utils.IdentifierGenerator>()
				.Default("");
			DiscriminateSubClassesOnColumn("SubjectType").CustomType<String>();
		}
	}

	public class ImageSubjectMap : SubclassMap<ImageSubject>
	{
		public ImageSubjectMap()
		{
			Not.LazyLoad();
			Map(x => x.RealSizeImageId).Length(50);
			Map(x => x.SubjectImageId).Length(50);
			DiscriminatorValue("image");
		}
	}
}
